<?php

	//RENDER ROSTER
	$time = strtotime("2011-02-01");
	$ts_firstDay = mktime(0, 0, 0, date("m",$time), 1, date("y",$time));
	$ts_lastDay = mktime(0, 0, 0, date("m",$time)+1, 0, date("y",$time));

 	$tbl_date = '<table class="datelist">'."\n";
	$tbl_date.= "\t\t\t\t".'<tr>'."\n";
	switch(date('m',$ts_firstDay)){
		case '01':
			$monthname = 'Januar';
			break;
		case '02':
			$monthname = 'Februar';
			break;
		case '03':
			$monthname = 'März';
			break;
		case '04':
			$monthname = 'April';
			break;
		case '05':
			$monthname = 'Mai';
			break;
		case '06':
			$monthname = 'Juni';
			break;
		case '07':
			$monthname = 'Juli';
			break;
		case '08':
			$monthname = 'August';
			break;
		case '09':
			$monthname = 'September';
			break;
		case '10':
			$monthname = 'Oktober';
			break;
		case '11':
			$monthname = 'November';
			break;
		case '12':
			$monthname = 'Dezember';
	}
	$tbl_date.= "\t\t\t\t\t".'<td class="description"><b>'.$monthname.'</b><br />'.date('Y',mktime(0, 0, 0, date("m",$time), date("d",$time), date("y",$time))).'</td>'."\n";
	for($i = 0; $i < date("d",$ts_lastDay); $i++){
		$day = date('D',mktime(0, 0, 0, date("m",$ts_firstDay),date("d",$ts_firstDay) + $i, date("y",$time)));
		switch($day){
			case 'Mon':
				$weekday = 'Mo';
				break;
			case 'Tue':
				$weekday = 'Di';
				break;
			case 'Wed':
				$weekday = 'Mi';
				break;
			case 'Thu':
				$weekday = 'Do';
				break;
			case 'Fri':
				$weekday = 'Fr';
				break;
			case 'Sat':
				$weekday = 'Sa';
				break;
			case 'Sun':
				$weekday = '<b>So</b>';
		}
		$tbl_date.= "\t\t\t\t\t".'<td>'.$weekday.'<br />'.date('d',mktime(0, 0, 0, date("m",$time), +1 +$i, date("y",$time))).'</td>'."\n";
	}
	$tbl_date.= "\t\t\t\t\t".'<td class="actual_state">&nbsp;<br />Ist</td>'."\n";
	$tbl_date.= "\t\t\t\t\t".'<td class="target_state">&nbsp;<br />Soll</td>'."\n";
	$tbl_date.= "\t\t\t\t\t".'<td class="overtime_total">&nbsp;<br />ÜSt.</td>'."\n";
	$tbl_date.= "\t\t\t\t".'</tr>'."\n";
	$tbl_date.= "\t\t\t".'</table>'."\n";
	//---------------------------------------------------------------------------------------------------------------------------------------------//
	
 	$tbl_employees = '<table class="employees">'."\n";
 	for($z = 0; $z < 10; $z++){
		$tbl_employees.= "\t\t\t\t".'<tr>'."\n";
		$tbl_employees.= "\t\t\t\t\t".'<td class="description">Mitar Beiter '.($z+1).'</td>'."\n";
		for($i = 0; $i < date("d",$ts_lastDay); $i++){
			$tbl_employees.= "\t\t\t\t\t".'<td>&nbsp;</td>'."\n";
		}
		$tbl_employees.= "\t\t\t\t\t".'<td class="actual_state">0</td>'."\n";
		$tbl_employees.= "\t\t\t\t\t".'<td class="target_state">0</td>'."\n";
		$tbl_employees.= "\t\t\t\t\t".'<td class="overtime_total">0</td>'."\n";
		$tbl_employees.= "\t\t\t\t".'</tr>'."\n";
 	}
	$tbl_employees.= "\t\t\t".'</table>'."\n";
	
?>
			
			<h3>Wohnbereich x</h3>
			<div class="roster">
				<?php echo $tbl_date; ?>
				<?php echo $tbl_employees; ?>
			</div>